import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;

import javax.swing.ImageIcon;
import javax.swing.border.LineBorder;

public class CornerLot extends Lot
{
	//private String cornerType; // Go, Jail, FreeParking, GoToJail
	private int value; // value of money in FreeParking and Go (Go is $200)

	// Dimensions:
	private final int WIDTH = 100;	// width of the lot graphic
	private final int HEIGHT = 100;	// height of the lot graphic
	
	private ImageIcon imageGo; // image used for the Go logo on the lot
	private ImageIcon imageJail; // image used for the Jail logo on the lot
	private ImageIcon imageFreeParking; // image used for the FreeParkingGoToJail logo on the lot
	private ImageIcon imageGoToJail; // image used for the GoToJail logo on the lot

	public CornerLot(String name, String type, String location)
	{
		super(name, type, location);
		// name choices:  Go, Jail, FreeParking, GoToJail
		// type choices:  corner
		// location choices:  northwest, northeast, southwest, southeast

		if(name == "Go")
		{	
			value = 200;
			imageGo = new ImageIcon("./logos/Go_small.jpg");
		}
		else if(name == "FreeParking")
		{
			value = 0;
			imageFreeParking = new ImageIcon("./logos/FreeParking_small.jpg");
		}
		else if(name == "Jail")
			imageJail = new ImageIcon("./logos/Jail_small.jpg");
		else if(name == "GoToJail")
			imageGoToJail = new ImageIcon("./logos/GoToJail_small.jpg");
		
		setPreferredSize(new Dimension(WIDTH, HEIGHT));
		setBorder(new LineBorder(Color.black));
		setBackground(Color.RED);
		setOpaque(false);
		
	} // end CornerLot constructor
	
	public String getName()
	{
		return name;
	} // end getName
	
	public void addToFreeParking(int increase)
	{
		value = value + increase;
	} // end addToFreeParking
	
	// will actually draw the image:
	public void paintComponent(Graphics g)
	{	
		super.paintComponent(g);
		g.setColor(new Color(200,222,186));
		g.fillRect(0, 0, 100, 100);
		g.setColor(Color.black);
		
		if(location == "northwest")		
		{
			imageFreeParking.paintIcon(this, g, 1, 2);
		}
		else if(location == "northeast")
		{
			imageGoToJail.paintIcon(this, g, 1, 0);
		}
		else if(location == "southeast")
		{
			imageGo.paintIcon(this, g, 2, 1);
		}
			else if(location == "southwest")
		{
			imageJail.paintIcon(this, g, 1, 1);;
		}			
	} // end paintComponent	
} // end class CornerLot
